package com.yunhe.tianhe.rentcars.controller.client;/**
 * Created by Administrator on 2017/11/23 0023.
 */

import com.yunhe.tianhe.commons.dto.Pageable;
import com.yunhe.tianhe.rentcars.entity.client.Client;
import com.yunhe.tianhe.rentcars.entity.system.MemberLevel;
import com.yunhe.tianhe.rentcars.service.client.ClientService;
import com.yunhe.tianhe.rentcars.service.system.MemberLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @user yanxiu
 * @creat 2017-11-23 上午 11:24
 * @desc
 **/
@Controller
@RequestMapping("/client")
public class ClientController {

    @Autowired
    private ClientService clientService;
    @Autowired
    private MemberLevelService memberLevelService;

    @RequestMapping
    public String list(HttpServletRequest req){
        List<MemberLevel> memberLevelList = memberLevelService.findList();
        req.setAttribute("memberLevelList",memberLevelList);
        return "client/client";
    }

    @RequestMapping("/searchData")
    @ResponseBody
    public Pageable<Client> searchList(Integer offset, Integer limit, Long memLevel, String addTime, String mobile, String lastTime){
        Pageable<Client> searchPage = clientService.searchList(offset, limit, memLevel, addTime, mobile, lastTime);
        return searchPage;
    }

    @RequestMapping("/pan")
    public String yu(){
        return "/zuche/pan";
    }
}
